﻿using Interface;

namespace Framework
{
    public static class ExtensionMethods
    {
        public static ILogicAnalyzer ActiveLogicAnalyzer(this Framework framework)
        {
            return framework.LogicAnalyzers[framework.SelectedLogicAnalyzerIndex];
        }

        public static string PrettyPrintTime(this double time)
        {
            if (time < (1.0 / 1000.0))
            {
                return string.Format("{0} us", time * 1000000);
            }
            else if (time < 1.0)
            {
                return string.Format("{0} ms", time * 1000);
            }
            return string.Format("{0} s", time);
        }
    }
}
